      package servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import Dao.Daouser;
import Dao.impl.Daoimpluser;
import entity.User;
@WebServlet(name="denglupanduan",urlPatterns="/denglupanduan.do")
public class denglupanduan extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		HttpSession session = request.getSession();
		int uid=0;
		try {
			uid = (Integer) session.getAttribute("che");
		} catch (NullPointerException e) {
			// TODO: handle exception
		}
		if(uid!=0){
			Daouser uDao=new Daoimpluser();
			User user=uDao.currentU(uid);
			user.getName();
			request.setAttribute("u",user);
			
			
			
			request.getRequestDispatcher("GeRenZhongXin.jsp").forward(request, response);
		}else{
			request.getRequestDispatcher("denglu.jsp").forward(request, response);
		}
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
